package com.foreknow.demo4;

/**
 * 找出数组中最大值的下标位置
 */
public class TestMethod9 {

    public static int maxIdex(int[] array) {
        int maxIndex = 0;
        for (int i = 1;i<array.length;i++) {
            if (array[maxIndex] < array[i]) {
                maxIndex = i;
            }
        }
        return maxIndex;
    }

    public static void main(String[] args) {
        int[] arr = {12,14,35,27,19};
        int m = maxIdex(arr);
        System.out.println(m);
    }
}








